
'use strict'
import config from '../../../config/config'
import { View } from '../../../component'
import style from './css.css'
const stateIcon = [style.stateIcon1, style.stateIcon2, style.stateIcon5, style.stateIcon3, style.stateIcon3]
class RecordList extends React.Component {
  static propTypes = {
    item: PropTypes.object,
    history: PropTypes.object
  }
  _handleClick = this._handleClick.bind(this)

  _handleClick () { window.location.href = `${config.DomainName}/v1/doll/web/recorddetail?roundid=${this.props.item.round_id}&catch=1&single=1` }

  render () {
    // dollState: 0,  //订单状态，0待处理, 1待发货，2已发货，3已经兑换, 4热猫自动兑换, 5已经退币
    const dollState = this.props.item.order_status
    const { doll_detail, time, date } = this.props.item
    const dollName = doll_detail.doll_name
    const dollImg = doll_detail.doll_pic

    return (
      <View className={style.recordList} tap={this._handleClick}>
        <View className={style.dollIcon} style={{ backgroundImage: `url(${dollImg})` }}>
          <View className={stateIcon[dollState]}></View>
        </View>
        <View className={style.dollName}>{dollName}</View>
        <View className={style.dollTime}>{date} {time}</View>
      </View>
    )
  }
}

export default RecordList
